package com.theaf.basemodule.common.model;

import com.theaf.core.annotation.FieldCn;
import io.swagger.annotations.ApiModel;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.validator.constraints.NotEmpty;

import javax.persistence.*;

/**
 * @Author:songwenke
 * @Description:
 * @Date:create in 14:49 2017/12/21
 * @Modified By:
 **/
@ApiModel("地区表")
@Entity
@Table(name = "sys_area")
@Data
@AllArgsConstructor
@NoArgsConstructor
public class SysArea {
    @Id
    @Column(name = "id")
    @GeneratedValue(strategy = GenerationType.SEQUENCE,generator = "user_id_req")
    @SequenceGenerator(name = "user_id_req", sequenceName = "sys_req")
    @FieldCn(value = "id")
    private long id;
    @OneToOne
    @JoinColumn(name="pid")
    private SysArea parent;
    @Column(name = "name")
    @NotEmpty(message = "地区名称不能为空")
    @FieldCn(value = "地区名称")
    private String name;
    @Column(name = "type")
    @FieldCn(value = "地区类型",note = "见数据字典AREA_TYPE")
    private String type;
    @FieldCn(value = "地区邮编")
    @Column(name = "zip")
    private String zip;
    @FieldCn(value = "级别编码")
    @Column(name = "level_code")
    private String levelCode;
}
